﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Com.CMS263.PO;

namespace Com.CMS263.DAO
{
    public class ReceiveAddressDAO
    {
        public ReceiveAddressDAO() { }

        public bool Add(ReceiveAddress ra)
        {
            try
            {
                DBHelper.TransSaveOrUpdate(ra);
                return true;
            }
            catch 
            {
                return false;
            }
        }
        public ReceiveAddress GetRAByUserId(int userId)
        {
            try
            {
                return DBHelper.ExecuteHQL("from ReceiveAddress where userId=" + userId).List<ReceiveAddress>().First();
            }
            catch 
            {

                return null;
            }
            
        }
        public bool Modifly(ReceiveAddress ra)
        {
            try
            {
                DBHelper.TransSaveOrUpdate(ra);
                return true;
            }
            catch 
            {

                return false;
            }
            
        }
    }
}
